home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Messaging Service Access Module / Internet PMSAM / Template source / Internet Address Template / GenericAddress.r next >
Encoding:
Text File  |  1993-08-20  |  9.4 KB  |  291 lines  |  [TEXT/MPS ]

  1. /*
  2.  
  3.   ####################################################################
  4.   Internet PMSAM Sample Address Template
  5.   1.0b1 version
  6.   
  7.   Steve Falkenburg
  8.   MacDTS 2/11/93
  9.   AppleLink DEVSUPPORT for questions (if you're a supported seed site)  
  10.   ####################################################################
  11.   
  12.   This template is a generic personal MSAM address template where the additional
  13.   extension information is a single RString with the external system address in
  14.   a single string representation.  In addition, there is an info-page field for
  15.   changing the name of the address (which can also be done from the address sublist)
  16.   
  17.   To adapt for your own use, just modify the contents of the file "SpecificAddress.r"
  18.   
  19.   to build:
  20.  
  21.   Rez -i "{CIncludes}" "GenericAddress.r" -append -o InternetAddress
  22.   SetFile -t 'detf' InternetAddress
  23.  
  24. */
  25.  
  26. #ifndef __TYPES__
  27. #include "Types.r"
  28. #endif
  29.  
  30. #ifndef __OCE.R__
  31. #include "OCE.r"
  32. #endif
  33.  
  34. #ifndef __OCE__
  35. #include "OCE.h"
  36. #endif
  37.  
  38. #ifndef __OCETEMPLATES__
  39. #include "OCETemplates.h"
  40. #endif
  41.  
  42.  
  43.  
  44. // our properties ########################################################################
  45.  
  46. #define kXtnType            kDETFirstDevProperty
  47. #define kPrDNodeNumber        (kDETFirstDevProperty+1)
  48. #define kPrDirName            (kDETFirstDevProperty+2)
  49. #define kPrDirDiscA            (kDETFirstDevProperty+3)
  50. #define kPrDirDiscB            (kDETFirstDevProperty+4)
  51. #define kPrPart1            (kDETFirstDevProperty+5)
  52. #define kPrPart2            (kDETFirstDevProperty+6)
  53. #define kPrPart3            (kDETFirstDevProperty+7)
  54. #define kPrNumOfPathParts    (kDETFirstDevProperty+8)
  55. #define kPrCidSource         (kDETFirstDevProperty+9)            /* long 00000000*/ 
  56. #define kPrCidSequence         (kDETFirstDevProperty+10)            /* long 00000000*/ 
  57. #define kPrEntityName         (kDETFirstDevProperty+11) 
  58. #define kPrEnitiyType         (kDETFirstDevProperty+12)             /* RSrting " User" */
  59. #define kPrAddress             (kDETFirstDevProperty+13)             // Inet Address RString
  60.  
  61.  
  62.  
  63. // type declarations that we need ########################################################
  64.  
  65. // here's a convenience type declaration for defining our 'detb' resource
  66. // if you want to use this to set up an address template for your personal
  67. // MSAM, you all you should have to change is the resource 'detb' declaration,
  68. // not this type
  69.  
  70. type 'detb' {
  71.     longInt;                                                // address type (you fill in)
  72.     integer = (end1-start1)/8;                                // length of all data following
  73. start1:
  74.     longInt;                                                // address type (you fill in)
  75.     integer = (endPRID-startPRID)/8;                        // length of packed recordid
  76. startPRID:
  77.     integer = (endRLI-startRLI)/8;                            // length of packed rli
  78. startRLI:
  79.     longInt = 0;                                            // dNode # (0)
  80.     rstring;                                                // directory name (you fill in)
  81.     align word;
  82.     longInt;                                                // discriminator A (you fill in)
  83.     longInt = 0;                                            // discriminator B
  84.     integer = (endPackedPath-startPackedPath)/8;            // packed pathname size
  85. startPackedPath:
  86.     integer = 3;                                            // # of pathname parts (3)
  87.     longInt = 0;                                            // path part 1 (0)
  88.     longInt = 0;                                            // path part 2 (0)
  89.     longInt = 0;                                            // path part 3 (0)
  90. endPackedPath:
  91. endRLI:
  92.     longInt = 0;                                            // CreationID source (0)
  93.     longInt = 0;                                            // CreationID seq (0)
  94.     rstring;                                                // name RString (you fill in)
  95.     align word;
  96.     rstring;                                                // type RString (you fill in)
  97.     align word;
  98. endPRID:
  99.     rstring;                                                // extension value (you fill in)
  100.     align word;
  101. end1:    
  102. };
  103.  
  104.  
  105.  
  106. // template ID ranges ##################################################################
  107.  
  108. // note that we used resource IDs starting way up at 5000, since this template
  109. // will be rezzed into an MSAM which also has a setup template, so we don't want
  110. // to use the same DET resource ID space
  111.  
  112. #define kAddressAspect            (5000)                // aspect
  113. #define kAddressInfoPage        (5000+kDETIDSep)    // info page
  114. #define kAddressRecordType        kUserRecTypeBody
  115.  
  116. #define    kAttributeInfoWindHeight    200
  117. #define    kAttributeInfoWindWidth        259
  118.  
  119. // information specific to your address template #######################################
  120.  
  121. #include "SpecificAddress.r"
  122.  
  123.  
  124. // aspect template (used for both main and info page aspects) ###########################
  125.  
  126. // 'deta' this is a aspect template
  127. resource 'deta' (kAddressAspect, purgeable) { 0, dropCheckConflicts, isMainAspect };
  128.  
  129. // template name
  130. resource 'rstr' (kAddressAspect+kDETTemplateName, purgeable) {
  131.     kAspectTemplateName
  132. };
  133.  
  134. // the kind is address
  135. resource 'rstr' (kAddressAspect+kDETAspectKind, purgeable) {
  136.     kAspectKind
  137. };
  138.  
  139. // new menu name
  140. resource 'rstr' (kAddressAspect+kDETAspectNewMenuName, purgeable) {
  141.     kNewMenuName
  142. };
  143.  
  144. // this template apply to the kMailSlotsAttrTypeBody attribute
  145. resource 'rstr' (kAddressAspect+kDETAttributeType, purgeable) {
  146.     kMailSlotsAttrTypeBody
  147. };
  148.  
  149. // tag of attribute this applies to
  150. resource 'detn' (kAddressAspect+kDETAttributeValueTag)
  151. {
  152.     kSignature
  153. };
  154.  
  155. // category for template
  156. resource 'rst#' (kAddressAspect+kDETAspectCategory, purgeable) {
  157.     {kDETCategoryAddressItems}
  158. };
  159.  
  160. // custom window size for address templates
  161. resource 'detw' (kAddressAspect+kDETAspectInfoPageCustomWindow, purgeable) {
  162.     {0, 0, kAttributeInfoWindHeight, kAttributeInfoWindWidth},
  163.     discludePopUp
  164. };
  165.  
  166. // dett attribute look up table
  167. // if you want to change this table, do change kDETAspectNewValue detb to match the new table
  168. // the table is for a personal MSAM address with an RString as the extension value
  169. resource 'dett' (kAddressAspect+kDETAspectLookup, purgeable)
  170.     {{
  171.         {kMailSlotsAttrTypeBody},
  172.         kSignature,
  173.         useForInput,    
  174.         useForOutput, 
  175.         notInSublist,    
  176.         isNotAlias,isNotRecordRef,
  177.         // mailslot attribute
  178.         { 
  179.         
  180.             //                                        unused fields here
  181.         
  182.             /* generic stuff (no changes needed) */
  183.             
  184.             'wsiz',                                 kDETNoProperty,    0;         // length of indented data
  185.             '((((',                                    kDETNoProperty,    0;
  186.                 'long', kXtnType,                                       0;         // extension type
  187.                 'wsiz',                                kDETNoProperty,    0;         // packed record ID length
  188.                 '((((',                                kDETNoProperty,    0;         
  189.                     'wsiz',                            kDETNoProperty,    0;        // RLI length
  190.                     '((((',                            kDETNoProperty,    0;        
  191.                         'long', kPrDNodeNumber,                        0;        // dNode # (0 for us)
  192.                         'rstr', kPrDirName,                            0;        // directory name
  193.                         'awrd', kDETNoProperty,                        0;
  194.                         'long', kPrDirDiscA,                        0;        // directory disc 1 (our signature)
  195.                         'long', kPrDirDiscB,                        0;        // directory disc 2 (0L)
  196.                         'wsiz', kDETNoProperty,                     0;
  197.                         '((((', kDETNoProperty,                        0;        // packed pathname length
  198.                             'word', kPrNumOfPathParts,                0;        // # of parts (3)
  199.                             'rstr', kPrPart1,                        0;        // part 1 ("")
  200.                             'awrd',                 kDETNoProperty,    0;        
  201.                             'rstr', kPrPart2,                        0;        // part 2 ("")
  202.                             'awrd',                    kDETNoProperty,    0;
  203.                             'rstr', kPrPart3,                        0;        // part 3 ("")
  204.                             'awrd',                    kDETNoProperty,    0;
  205.                         '))))',                        kDETNoProperty,    0;
  206.                     '))))',                            kDETNoProperty,    0;
  207.                     'long', kPrCidSource,                             0;        // creation ID source 
  208.                     'long', kPrCidSequence,                         0;        // creation ID seq
  209.                     'rstr', kDETAspectName,                         0;         // name of this address (RString)
  210.                     'awrd',                         kDETNoProperty,    0;
  211.                     'rstr', kPrEnitiyType,                             0;         // entity type (aoce User)
  212.                     'awrd',                         kDETNoProperty, 0;
  213.                 '))))',                                kDETNoProperty,    0;
  214.                 
  215.                 /* specific address information */
  216.                 
  217.                 'rstr', kPrAddress,                                 0;             // your address (RString)
  218.                 'awrd',                         kDETNoProperty,    0;
  219.                 
  220.             '))))',                                    kDETNoProperty,    0;        
  221.             'Pref',                                    kDETNoProperty,    0        // save pref mailslot (built-in code)
  222.         };
  223.     }};
  224.  
  225.  
  226. // info-page template #################################################################
  227.  
  228. // item location in inforpage template window
  229.  
  230. #define kLineTop                        (kDETSubpageIconBottom+32)
  231. #define kLineBottom                        kLineTop+1
  232. #define    kAddressTop                        (kLineBottom+10)
  233. #define kAddressBottom                    (kAddressTop + kDETAppFontLineHeight+4)
  234.  
  235. #define kMy1stColumnLeft    8
  236. #define kMy1stColumnRight    76
  237. #define kMy2ndColumnLeft    80
  238. #define kMy2ndColumnRight    kAttributeInfoWindWidth - 16
  239.  
  240. // info page (view) template ('deti')
  241. resource 'deti' (kAddressInfoPage, purgeable) {
  242.     1000,    // template sort order
  243.     kDETNoSublistRect,
  244.     noSelectFirstText,
  245.     {
  246.     kDETNoProperty, kDETNoProperty, kAddressInfoPage;
  247.     },
  248.     {}
  249. };
  250.  
  251. // this is the name of the InfoPage template, don't use the same name as your aspect name
  252. resource 'rstr' (kAddressInfoPage+kDETTemplateName, purgeable) {
  253.     kInfoPageTemplateName
  254. };
  255.  
  256. // this template applies to the kMailSlotsAttrTypeBody attribute
  257. resource 'rstr' (kAddressInfoPage+kDETAttributeType, purgeable) {
  258.     kMailSlotsAttrTypeBody
  259. };
  260.  
  261. // title of the built-in info page view popup
  262. resource 'rstr' (kAddressInfoPage+kDETInfoPageName, purgeable) {
  263.     kPopUpTitle
  264. };
  265.  
  266. // this is to relate the info page to the right aspect
  267. // this needs to be the same string as the kDETTemplateName of the aspect template
  268. resource 'rstr' (kAddressInfoPage+kDETInfoPageMainViewAspect, purgeable) {
  269.     kAspectTemplateName
  270. };
  271.  
  272.  
  273. // our view resource.  this defines the locations of the user interface elements
  274. // in the info-page window.
  275. resource 'detv' (kAddressInfoPage, purgeable)
  276. {
  277.     {                
  278.         kDETSubpageIconRect, kDETNoFlags, kDETAspectMainBitmap,
  279.         Bitmap { kDETLargeIcon };
  280.  
  281.         {kLineTop,kMy1stColumnLeft,kLineBottom,(kAttributeInfoWindWidth-8)}, kDETNoFlags, kDETNoProperty,
  282.         Box { kDETBoxIsGrayed };
  283.  
  284.         {kAddressTop, kMy1stColumnLeft, kAddressBottom, kMy1stColumnRight}, kDETNoFlags, kDETNoProperty,
  285.         StaticTextFromView { kDETApplicationFont, kDETApplicationFontSize, kDETRight, kDETBold,"Address:" };
  286.  
  287.         {kAddressTop, kMy2ndColumnLeft, kAddressBottom, kMy2ndColumnRight}, kDETNoFlags, kPrAddress,
  288.         EditText { kDETApplicationFont, kDETApplicationFontSize, kDETLeft, kDETNormal };
  289.     };
  290. };
  291.